package com.app.util.http;

import org.apache.http.client.config.CookieSpecs;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;

public class HttpClientPool {
	
	private static PoolingHttpClientConnectionManager manager = null; 
    static{
    	manager = new PoolingHttpClientConnectionManager();
    	manager.setMaxTotal(400);
    	manager.setDefaultMaxPerRoute(50);
    }
    public static CloseableHttpClient getHttpClient(){
        RequestConfig globalConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();  
        CloseableHttpClient client = HttpClients.custom().setConnectionManager(manager).setDefaultRequestConfig(globalConfig).build();  
        return client;
    }
}
